package xyz.erupt.flow.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import xyz.erupt.flow.bean.entity.OaWorkFlowGroup;

import java.util.List;
import java.util.Set;

public interface OaWorkFlowGroupRepository extends JpaRepository<OaWorkFlowGroup,Long>, JpaSpecificationExecutor {
    @Query("select g from oa_work_flow_group g where g.groupName like concat('%',:keyword,'%') or g.groupId = (select d.workFlowGroup.groupId from oa_work_flow_definition d where d.formName like concat('%',:keyword,'%') order by g.sort asc ) ")
    List<OaWorkFlowGroup> findAllByKeyword(@Param("keyword") String keyword);
}
